package com.taillive.commons;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

public class Encoder {
	
	public static String encodeUTF8(String s){
		if(s==null)
			return "";
		try {
			return URLEncoder.encode(s, "utf-8").toLowerCase();
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
			return null;
		}
	}
	
	
	public static String decodeUTF8(String s){
		if(s==null)
			return "";
		try {
			return URLDecoder.decode(s, "utf-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
			return null;
		}
	}
	
	
}
